import request from '@/utils/request'

export function fetchCommentsByTopicId(topic_id) {
    return request({
        url: '/comment/get_comments',
        method: 'GET',
        params: {
            topicid: topic_id
        }
    })
}

export function pushComment(data) {
    return request({
        url: '/comment/add_comment',
        method: 'POST',
        data: data
    })
}

//删除评论
export function deleteComment(id) {
    return request({
      url: `/comment/delete/${id}`,
      method: 'DELETE'
    })
  }

//回复评论
export function pushParentComment(data) {
    return request({
        url: '/comment/add_parentcomment',
        method: 'POST',
        data: data
    })
}

export function get_allcomments() {
    return request({
        url: '/comment/get_allcomments',
        method: 'GET',
    })
}

